package org.speed.jdk;

import java.util.Stack;


public class MyQueue {
	
	private Stack<String> s1 = new Stack<String>();
	private Stack<String> s2 = new Stack<String>();
	
	public void push(String obj) {
		s1.push(obj);
	}
	
	public String pop() {
		move();
		return s2.pop();
	}
	
	private void move() {
		while(!s1.isEmpty()) {
			s2.add(s1.pop());
		}
	}
	
	public static void main(String[] args) {
		MyQueue myQueue = new MyQueue();
    	myQueue.push("1");
    	myQueue.push("2");
    	myQueue.push("3");
    	
    	System.out.println(myQueue.pop());
    	System.out.println(myQueue.pop());
    	System.out.println(myQueue.pop());

    	
    	
        System.out.println( "Hello World!" );
		
		
	}
	
}
